{% extends "simple_cfp/cfp_base.html" %}
{% load i18n %}
{% block content %}
<div id="content-main">
    <style type="text/css">
        .cfp_form_error { color: #FF0000; font-weight: bold }
    </style>

    {% if speaker %}
        <p>
        Submissions by {{ speaker.first_name }} {{ speaker.last_name }}.
        </p>

        {% if presentations %}
        <table border="1">
        <tr>
            <th>Status</th>
            <th>Submission Date</th>
            <th>Title</th>
            <th>Description</th>
            {% if upload %}
            <th>Presentation</th>
            <th>Uploaded New Presentation</th>
            <th>Delete Presentation</th>
            {% endif %}
        </tr>
        {% for p in presentations %}
        <tr>
            <td>{{ p.status }}</td>
            <td>{{ p.submit_date }}</td>
            <td>{{ p.title }}</td>
            <td>{{ p.description }}</td>
            {% if upload %}
            <td>
            {% if p.file %}
            <a href="{{ p.file.url }}">Uploaded</a>
            {% else %}
            Not uploaded
            {% endif %}
            </td>
            <td nowrap>
            <form method="post" action="." enctype="multipart/form-data">
                <input type="hidden" name="code" value="{{ code }}">
                <input type="hidden" name="contact_email" value="{{ contact_email }}">
                <input type="hidden" name="speaker_email" value="{{ speaker_email }}">
                <input type="hidden" name="presentation" value="{{ p.id }}">
                <input type="file" name="file">
                <input type="submit" value="Upload" />
            </form>
            </td>
            <td>
            {% if p.file %}
            <form method="post" action=".">
                <input type="hidden" name="code" value="{{ code }}">
                <input type="hidden" name="contact_email" value="{{ contact_email }}">
                <input type="hidden" name="speaker_email" value="{{ speaker_email }}">
                <input type="hidden" name="delete" value="{{ p.id }}">
                <input type="submit" value="Delete" />
            </form>
            {% else %}
            <input type="submit" value="Delete" disabled />
            {% endif %}
            </td>
            {% endif %}
        </tr>
        {% endfor %}
        </table>
        {% else %}
        No submitted presentations. Please
        <a href="../submit_presentation/">submit presentations</a> first.
        {% endif %}
    {% else %}
    <p>
    Please type in your contact email, speaker email, and validation code to
    view the status of your submissions.
    </p>

    <p>
    The fields in <b>bold</b> are required.
    </p>

    {% if error %}
    <p class="cfp_form_error">{{ error }}</p>
    {% endif %}

    <form method="post" action=".">
    <table>
    <tr>
        <td><b>Contact Email:</b></td>
        <td><input type="text" name="contact_email" maxlength="80" value="{{ contact_email }}" /></td>
    </tr>
    <tr>
        <td><b>Speaker Email:</b></td>
        <td><input type="text" name="speaker_email" maxlength="80" value="{{ speaker_email }}" /></td>
    </tr>
    <tr>
        <td><b>Validation Code:</b></td>
        <td><input type="text" name="code" maxlength="80" value="{{ code }}" /></td>
    </tr>
    </table>

    <p>
    <input type="submit" value="View Status" />
    </p>
    </form>
    {% endif %}
</div>
{% endblock %}
